
#ifndef PSPVIDEO_H
#define PSPVIDEO_H

#include <wchar.h>

#define RED         0xFF0000FF
#define DARKRED     0xFF00008B
#define MAROON      0xFF000080
#define GREEN       0xFF00FF00
#define BLUE        0xFFFF0000
#define DARKBLUE    0xFF8B0000
#define NAVY        0xFF800000
#define DEEPSKYBLUE 0xFFFFBF00
#define ROYALBLUE   0xFFE16941
#define YELLOW      0xFF00FFFF
#define BROWN       0xFF2A2AA5
#define WHITE       0xFFFFFFFF
#define GRAY        0xFF808080
#define DARKGRAY    0xFFA9A9A9
#define LIGHTGRAY   0xFFD3D3D3	
#define BLACK       0xFF000000

#define SCR_WIDTH           480
#define SCR_HEIGHT          272
#define BUF_WIDTH           512
#define	FRAMESIZE           (BUF_WIDTH * SCR_HEIGHT * 4)
#define SLICE_SIZE          64 // change this to experiment with different page-cache sizes
#define GU_FRAME_ADDR(frame)    (void*)((unsigned long)frame | 0x44000000)
#define RGB444(r,g,b)       ((((b & 0xf0) << 4) | (g & 0xf0) | ((r & 0xf0) >> 4)) | 0xf000)
#define RGB555(r,g,b)       ((((b & 0xf8) << 7) | ((g & 0xf8) << 2) | ((r & 0xf8) >> 3)) | 0x8000)
#define RGB(r,g,b)          (((b) << 16) | ((g) << 8) | (r) | 0xFF000000)
#define SHOW_FRAME  0
#define DRAW_FRAME  1

typedef struct rect_t
{
	short left;
	short top;
	short right;
	short bottom;
} RECT;

void videoInit(void);
void videoExit(void);
void videoWaitVsync(void);
void videoWaitVsyncN(unsigned long count);
void videoFlipScreen(int vsync);
void* videoFrameAddr(void* frame, int x, int y);
void videoClearFrame(int frame_id);
void videoClearScreen(void);
void videoClearRect(RECT* rect);
void videoFillFrame(unsigned long color);
void videoFillRect(unsigned long color, RECT* rect);
void videoCopy(void* src);
void videoCopyRect(void *src, RECT *src_rect, RECT *dst_rect);
void mhStart(void);
void mhPrint(int x, int y, const char* str, unsigned int color, float size);
void mhPrintUCS2(int x, int y, const wchar_t* str, unsigned int color, float size);
void mhEnd(void);
void minimalRender(void);

#endif
